package com.yjymm.commonsdk.config.interceptor;

import org.springframework.core.annotation.Order;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.annotation.Annotation;

/**
 * @author panhaoxiong
 * @date 2021-02-07 11:50
        */
public interface LoginFilter {

    Boolean doVerify (HttpServletRequest request, HttpServletResponse response, Object handler);

    /**
     * 获取LoginFilter排名，值越小优先级越高
     * @return
     */
    default Integer getOrderNum(){
        Class clazz = this.getClass();
        Order order = (Order) clazz.getAnnotation(Order.class);
        if (order != null) {
            return order.value();
        }
        return 2147483647;
    }

}
